package com.seu.controller;

import com.alibaba.fastjson.JSON;
import com.seu.bean.Permission;
import com.seu.bean.User;
import com.seu.service.PermissionService;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
public class DispatchController {
    @Resource
    PermissionService permissionService;

    @RequestMapping("/*")      //拦截某一路径
    public String viewPage(@RequestBody User user){
        List<Permission> permissionList = permissionService.queryPermissionsByUser(user);
        return JSON.toJSONString(permissionList);       //返回当前权限（由前端拦截）
    }

}
